﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Hosting;
using System.Web.Mvc;

namespace WroxViewEngine
{
    public class WroxViewFactory: VirtualPathProviderViewEngine
    {
        public WroxViewFactory()
        {
            base.MasterLocationFormats = new string[] { "~/Views/{1}/{0}.wmaster", "~/Views/Shared/{0}.wmaster" };
            base.ViewLocationFormats = new string[] { "~/Views/{1}/{0}.wrox", "~/Views/Shared/{0}.wrox"};
            base.PartialViewLocationFormats = new string[] { "~/Views/{1}/{0}.wroxc", "~/Views/Shared/{0}.wroxc" };
        }


        protected override IView CreatePartialView(ControllerContext controllerContext, string partialVirtualPath)
        {
            return new WroxView(partialVirtualPath);
        }

        protected override IView CreateView(ControllerContext controllerContext, string viewVirtualPath, string masterVirtualPath)
        {
            return new WroxView(viewVirtualPath, masterVirtualPath);
        }


    }
}
